<?php use_helper('Javascript') ?>
<?php use_javascript('../sfProtoculousPlugin/js/prototype')?>
<div id="ListaDetalleGanadores">
<table border="1">
    <thead>
        <tr>
            <th>Item</th>
            <th>Usuario</th>
            <th>Monto</th>
            <th>Estado de Pago</th>
            <th>Fecha</th>
        </tr>
    </thead>
    <tbody>
        <?php $contador=1; foreach ($form->DetalleGanadores as $tupla): ?>
        <tr>
            <td><?php echo $contador++?></td>
            <td><?php echo $tupla->getsfGuardUserRelatedBySfGuardUser()         //traigo el nombre del usuario?></td>
            <td><?php echo number_format($tupla->getTotalpagado(),0, '','.')?></td>
            <td><?php if($tupla->getPagado())                           //si no está pagado, mostrar boton ajax
                    echo 'Pagado';
                    else{?>
                <input type="button" value="Pagar" id="pago<?php echo $contador?>"
                       onclick ="
                   new Ajax.Updater({success:'ListaDetalleGanadores'},
                  '<?php echo url_for('pozo/ActualizarDetalleGanador')?>',
                  {asynchronous:true, evalScripts:false,
                  onLoading:function(request,json){Element.show('loader')},
                  onComplete:function(request,json){Element.hide('loader');},
                  parameters: 'pozo_id=' + <?php echo $tupla->getPozoId()?> + ' &sf_guard_user=' + <?php echo $tupla->getsfGuardUser()?>
                  });
               ">
                <?php echo image_tag('loader.gif', 'size=15x15 id= loader style=display:none')?>
                    <?php }?>
            </td>
            <td><?php echo $tupla->getFechapago()?></td>
        </tr>
        <?php endforeach;?>
    </tbody>
</table>
</div>